import React from 'react';
import Icon from '../Icon/Icon';
import './index.scss';

export default class extends React.Component {
    constructor(props) {
        super(props);
    }

    onSearch = (e) => {
        const { onSearch } = this.props;
        const { value } = e.target;
        onSearch && onSearch(value);
    }


    render() {
        const { placeholder = '' } = this.props;
        return (
            <div className="search-box">
                <div className="search-box-input">
                    <input type="search" placeholder={placeholder} onChange={this.onSearch}/>
                </div>
                <Icon type="search" />
            </div>
        );
    }
}
